home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / util / shell / zshellsrc.lha / ZSH.S < prev    next >
Text File  |  1995-01-02  |  13KB  |  599 lines

  1.  
  2. ****************************************************
  3. ********   ZSHELL (C) 1990,91 Paul Hayter   ********
  4. ********  updated to V2.2 by Martin Gierich ********
  5. ********     ZShell-Starter (ZSH)        ********
  6. ****************************************************
  7.  
  8. ***        TABSIZE = 8 Chars         ***
  9. ***     Local Labels named .A to .Z         ***
  10.  
  11. VERSION            equ    $1234
  12.  
  13. FIB            equ    260            ;FileInfoBlock
  14. ACCESS_READ        equ    -2
  15. ACCESS_WRITE        equ    -1
  16. MODE_READWRITE        equ    1004
  17. MODE_OLDFILE        equ    1005
  18. MODE_NEWFILE        equ    1006
  19.  
  20. * PROCESS
  21. pr_MsgPort        equ    92
  22. pr_SegList        equ    128
  23. pr_StackSize        equ    132
  24. pr_GlobVec        equ    136
  25. pr_TaskNum        equ    140
  26. pr_StackBase        equ    144
  27. pr_Result2        equ    148
  28. pr_CurrentDir        equ    152
  29. pr_CIS            equ    156
  30. pr_COS            equ    160
  31. pr_ConsoleTask        equ    164
  32. pr_FileSystemTask    equ    168
  33. pr_CLI            equ    172
  34. pr_ReturnAddr        equ    176
  35. pr_PktWait        equ    180
  36. pr_WindowPtr        equ    184
  37.  
  38. * COMMAND LINE INTERFACE
  39. cli_Result        equ    0
  40. cli_SetName        equ    4
  41. cli_CommandDir        equ    8
  42. cli_ReturnCode        equ    12
  43. cli_CommandName        equ    16
  44. cli_FailLevel        equ    20
  45. cli_Prompt        equ    24
  46. cli_StandardInput    equ    28
  47. cli_CurrentInput    equ    32
  48. cli_CommandFile        equ    36
  49. cli_Interactive        equ    40
  50. cli_Background        equ    44
  51. cli_CurrentOutput    equ    48
  52. cli_DefaultStack    equ    52
  53. cli_StandardOutput    equ    56
  54. cli_Module        equ    60
  55.  
  56. RETURN_OK        EQU  0
  57. RETURN_WARN        EQU  5
  58. RETURN_ERROR        EQU  10
  59. RETURN_FAIL        EQU  20
  60.  
  61. *Assign Stuff
  62. dl_Root        equ    34    APTR
  63. rn_Info        equ    24    BPTR
  64. di_DevInfo    equ    4    BPTR
  65. di_NetHand    equ    16    BPTR
  66. dvi_Next    equ    0    BPTR
  67. dvi_Type    equ    4    LONG
  68. dvi_Task    equ    8    APTR
  69. dvi_Lock    equ    12    BPTR
  70. dvi_Handler    equ    16
  71. dvi_StackSize    equ    20
  72. dvi_Priority    equ    24
  73. dvi_Startup    equ    28
  74. dvi_SegList    equ    32
  75. dvi_GlobVec    equ    36
  76. dvi_Name    equ    40    BSTR
  77. dt_device    equ    0    <-- contents of dvi_Type
  78. dt_dir        equ    1
  79. dt_volume    equ    2
  80.  
  81. *Resident Stuff
  82. resi_link    equ    0    ;BPTR
  83. resi_usecount    equ    4    ;LONG
  84. resi_seglist    equ    8    ;BPTR
  85. resi_name    equ    12    ;BSTR
  86. resi_length    equ    4+4+4
  87.  
  88. *Icon Lib Stuff
  89. sm_Process    equ    $14
  90. sm_Segment    equ    $18
  91. sm_NumArgs    equ    $1c
  92. sm_ToolWindow    equ    $20
  93. sm_ArgList    equ    $24
  94. wa_Lock        equ    0
  95. wa_Name        equ    4
  96. do_Magic    equ    0    ;must be $e310
  97. do_Type        equ    $30
  98. do_ToolTypes    equ    $36
  99. do_ToolWindow    equ    $46
  100. do_StackSize    equ    $4a
  101.  
  102. * AVAIL STUFF
  103. MEMF_PUBLIC        equ 1
  104. MEMF_CHIP        equ 2
  105. MEMF_FAST        equ 4
  106. MEMF_CLEAR        equ $10000
  107. MEMF_LARGEST        equ $20000
  108.  
  109. * LIBRARY CALLS
  110. * EXEC
  111. _LVOOldOpenLibrary    equ    -408
  112. _LVOOpenLibrary        equ    -552
  113. _LVOCloseLibrary    equ    -414
  114. _LVOSetFunction        equ    -420
  115. _LVOAllocMem        equ    -198
  116. _LVOFreeMem        equ    -210
  117. _LVORawDoFmt        equ    -522
  118. _LVORawMayGetChar    equ    -510
  119. _LVOFindTask        equ    -294
  120. _LVOAddTask        equ    -282
  121. _LVOForbid        equ    -132
  122. _LVOPermit        equ    -138
  123. _LVOAvailMem        equ    -216
  124. _LVOPutMsg        equ    -366
  125. _LVOGetMsg        equ    -372
  126. _LVOReplyMsg        equ    -378
  127. _LVOWaitPort        equ    -384
  128. _LVOSetSignal        equ    -306
  129. _LVOAllocSignal        equ    -330
  130. _LVOFreeSignal        equ    -336
  131. _LVOOpenDev        equ    -444
  132. _LVOCloseDev        equ    -450
  133. _LVODoIO        equ    -456
  134.  
  135. * DOS
  136. _LVOSetProtection    equ    -186
  137. _LVOOutput        equ    -60
  138. _LVOWrite        equ    -48
  139. _LVOLock        equ    -84
  140. _LVOUnLock        equ    -90
  141. _LVODupLock        equ    -96
  142. _LVOExamine        equ    -102
  143. _LVOExNext        equ    -108
  144. _LVOOpen        equ    -30
  145. _LVOClose        equ    -36
  146. _LVORead        equ    -42
  147. _LVOInput        equ    -54
  148. _LVODeleteFile        equ    -72
  149. _LVORename        equ    -78
  150. _LVOCreateDir        equ    -120
  151. _LVOCurrentDir        equ    -126
  152. _LVOIoErr        equ    -132
  153. _LVOParentDir        equ    -210
  154. _LVOLoadSeg        equ    -150
  155. _LVOUnLoadSeg        equ    -156
  156. _LVOCreateProc        equ    -138
  157. _LVOInfo        equ    -114
  158. _LVODateStamp        equ    -192
  159. _LVOSeek        equ    -66
  160. _LVODeviceProc        equ    -174
  161. _LVODelay        equ    -198
  162. _LVOSetComment        equ    -180
  163. _LVOIsInteractive    equ    -216
  164.  
  165. *Intuition
  166. _LVOPrintIText        equ    -216
  167. _LVODisplayBeep        equ    -96
  168.  
  169. *Icon
  170. _LVOGetDiskObject    equ    -78
  171. _LVOFreeDiskObject    equ    -90
  172. _LVOFindToolType    equ    -96
  173. _LVOMatchToolValue    equ    -102
  174.  
  175.  
  176. * NEED THESE 2 MACROS FOR A68K ASSEMBLER
  177. ;blo    macro
  178. ;    bcs \1
  179. ;    endm
  180.     
  181. ;bhs    macro
  182. ;    bcc \1
  183. ;    endm
  184.  
  185. *Constants (only LONGS!)
  186. SHELLINE_SIZE    equ    256    V1.30
  187. CLIBUF_SIZE    equ    256
  188. NEWPRINTSIZE    equ    200
  189. PATH_SIZE    equ    256    V1.30
  190. HISTORY_SIZE    equ    1024    MUST BE POWER OF 2
  191. SEARCH_STRING_SIZE    equ    60
  192. DEST_LABEL_SIZE    equ    60
  193.  
  194. * THE GENERAL MEMORY BLOCK (LONGS!)
  195. blockbase    equ    0    ;the fib or info goes here
  196. sp_node        equ    blockbase+260    ;DOSpacket
  197. sp_reply    equ    sp_node+14
  198. sp_length    equ    sp_reply+4
  199. ;sp_ptr        equ    ;sp_ptr+4
  200. sp_link        equ    sp_length+2
  201. sp_port        equ    sp_link+4
  202. packettype    equ    sp_port+4
  203. sp_res1        equ    packettype+4
  204. sp_res2        equ    sp_res1+4
  205. myArg1        equ    sp_res2+4
  206. myArg2        equ    myArg1+4
  207. myArg3        equ    myArg2+4
  208. myArg4        equ    myArg3+4
  209. myArg5        equ    myArg4+4
  210. myArg6        equ    myArg5+4
  211. myArg7        equ    myArg6+4
  212. packettask    equ    myArg7+4
  213. devproc        equ    packettask+4
  214. dirlock        equ    devproc+4
  215. last_failcode    equ    dirlock+4
  216. outhandle    equ    last_failcode+4    ;Handles
  217. inhandle    equ    outhandle+4
  218. nonstdin    equ    inhandle+4    Allow 40 bytes
  219. nonstdout    equ    nonstdin+40    Allow 40 bytes
  220. stdout        equ    nonstdout+40
  221. stdin        equ    stdout+4
  222. EntryA0        equ    stdin+4
  223. better_Seglist    equ    EntryA0+4
  224. parm1        equ    better_Seglist+4 ;addr of each parameter within shelline
  225. parm2        equ    parm1+4
  226. parm3        equ    parm2+4
  227. parm4        equ    parm3+4
  228. parm5        equ    parm4+4
  229. parm6        equ    parm5+4
  230. parm7        equ    parm6+4
  231. parm8        equ    parm7+4
  232. parm9        equ    parm8+4
  233. parm10        equ    parm9+4
  234. parm11        equ    parm10+4
  235. parm12        equ    parm11+4
  236. parm13        equ    parm12+4
  237. parm14        equ    parm13+4
  238. parm15        equ    parm14+4
  239. endofparms    equ    parm15+4+4*10    10 extra parms
  240.  
  241. shelline    equ    endofparms+4    for NULL-end        
  242. endofshelline    equ    shelline+SHELLINE_SIZE
  243.  
  244. CLIbuf        equ    endofshelline
  245. NewPrintBuffer    equ    CLIbuf+CLIBUF_SIZE
  246. errorstack    equ    NewPrintBuffer+NEWPRINTSIZE
  247. topstack    equ    errorstack+4
  248. stacksize    equ    topstack+4
  249. temp1        equ    stacksize+4
  250. temp2        equ    temp1+4
  251. temp3        equ    temp2+4
  252. temp4        equ    temp3+4
  253. tempbuf        equ    temp4+4        double shellinesizebuffer
  254. temp2buf    equ    tempbuf+2*SHELLINE_SIZE    ;80 char temp buffer
  255. dosbase        equ    temp2buf+80
  256. intuibase    equ    dosbase+4
  257. Result2        equ    intuibase+4
  258. kickver        equ    Result2+4
  259. old_prompt    equ    kickver+2
  260. old_setname    equ    old_prompt+4
  261. old_homedir    equ    old_setname+4
  262. Unused        equ    old_homedir+4
  263. count_line    equ    Unused+18
  264. ignoreit    equ    count_line+4    for filenamecompletition
  265. OldCTask    equ    ignoreit+SEARCH_STRING_SIZE    for the future
  266. OldCIS        equ    OldCTask+4
  267. OldCOS        equ    OldCIS+4
  268. bordersize    equ    OldCOS+4
  269. scsize        equ    bordersize+4
  270. scaddr        equ    scsize+4
  271. scptr        equ    scaddr+4
  272. scflag        equ    scptr+4        new v1.29
  273. openwin_flag    equ    scflag+1
  274. noresi_flag    equ    openwin_flag+1
  275. noreview_flag    equ    noresi_flag+1
  276. ReviewMem    equ    noreview_flag+1
  277. ReviewPtr    equ    ReviewMem+4
  278. ReviewSize    equ    ReviewPtr+4
  279. patharea    equ    ReviewSize+4
  280. now        equ    patharea+PATH_SIZE
  281. nost        equ    now+4
  282. then        equ    nost+4
  283. past        equ    then+4    ;history buffer=1024 bytes
  284. thistask    equ    past+HISTORY_SIZE
  285. gather_ptr    equ    thistask+4
  286. gather        equ    gather_ptr+4 ;CSI string=40 bytes
  287. tempbytes    equ    gather+40
  288. first_set_defn    equ    tempbytes+2
  289. set_search_string    equ    first_set_defn+4
  290. mem_addr    equ    set_search_string+SEARCH_STRING_SIZE
  291. wild_flag    equ    mem_addr+4
  292. stat_mode_flag    equ    wild_flag+1
  293. wild_string    equ    stat_mode_flag+1    allow 80 chars for wildcard
  294. date_mark    equ    wild_string+80    3 lwords
  295. mem_mark    equ    date_mark+12    3 lwords chip/fast/total
  296. CD_string    equ    mem_mark+12    Allow 80 bytes.
  297. prompt_string    equ    CD_string+80    Allow 80 bytes.
  298. prompt_args    equ    prompt_string+80    Allow 40 bytes
  299. line_count    equ    prompt_args+40    Allow 40 bytes
  300. mult_comm_flag    equ    line_count+2    
  301. next_comm_ptr    equ    mult_comm_flag+2
  302. ctrl_c_flag    equ    next_comm_ptr+4
  303. failat_level    equ    ctrl_c_flag+2    word size
  304. cd_block    equ    failat_level+2
  305. cd_volnode    equ    cd_block+4
  306. recurs_flag    equ    cd_volnode+4
  307. indent_count    equ    recurs_flag+2
  308. resi_flag    equ    indent_count+2
  309. forcediskflag    equ    resi_flag+1
  310. CLIflag        equ    forcediskflag+1
  311. WBflag        equ    CLIflag+1
  312. window_old    equ    WBflag+1
  313. wb_msg        equ    window_old+4
  314. iconbase    equ    wb_msg+4
  315. diskobj        equ    iconbase+4
  316. filesys_old    equ    diskobj+4
  317. cdir_old    equ    filesys_old+4
  318. cdback        equ    cdir_old+4
  319. ctrl_codes    equ    cdback+4    Keyboard-CTRL-Codes
  320. if_flag        equ    ctrl_codes+16
  321. if_condition_flag    equ    if_flag+1
  322. goto_flag    equ    if_condition_flag+1
  323. unused        equ    goto_flag+1
  324. dest_label    equ    unused+1
  325. please_close_me    equ    dest_label+DEST_LABEL_SIZE
  326. mem_offset_addr    equ    please_close_me+4
  327. io_Message    equ    mem_offset_addr+4    ;io-request (timer)
  328. io_Device    equ    io_Message+20
  329. io_Unit        equ    io_Device+4
  330. io_Command    equ    io_Unit+4
  331. io_Flags    equ    io_Command+2
  332. io_Error    equ    io_Flags+1
  333. tv_secs        equ    io_Error+1
  334. tv_micro    equ    tv_secs+4
  335. io_pad        equ    tv_micro+4    ;don't remove
  336.     
  337. stackbot    equ    io_pad+8
  338. sizeofblk    equ    stackbot
  339.  
  340.  
  341.  
  342. ********************************************
  343.  
  344. ;    SECTION    MYSHELL,CODE
  345.     
  346. ;Try to open dos then do the shell
  347. start    moveq    #-1,d7
  348.     move.l    a0,a3
  349.     move.l    4.w,a6
  350.     move.l    #sizeofblk,d0
  351.     move.l    #1+1<<16,d1        "memf_public" & clear it
  352.     jsr    _LVOAllocMem(a6)    alloc general mem block
  353.     tst.l    d0
  354.     beq    blkfail
  355.     move.l    d0,a5            A5=MEMBASE
  356.     move.l    sp,topstack(a5)
  357.     move.l    a3,EntryA0(a5)
  358.     move.w    20(a6),kickver(a5)        Kickstart-Version
  359.     lea    intuiname(pc),a1
  360.     jsr    _LVOOldOpenLibrary(a6)
  361.     tst.l    d0
  362.     beq    intfail
  363.     move.l    d0,intuibase(a5)
  364.     lea    dosname(pc),a1
  365.     jsr    _LVOOldOpenLibrary(a6)
  366.     tst.l    d0
  367.     beq    dosfail
  368.     move.l    d0,dosbase(a5)
  369.     clr.w    CLIflag(a5)        delete CLI&WBflag
  370.     sub.l    a1,a1
  371.     jsr    _LVOFindTask(a6)
  372.     move.l    d0,thistask(a5)        save this task address
  373.     move.l    d0,a2
  374.     move.l    pr_CLI(a2),d0
  375.     bne.s    .A
  376.     subq.w    #1,CLIflag(a5)        WB-Start
  377.     lea    pr_MsgPort(a2),a0
  378.     jsr    _LVOWaitPort(a6)    !!!
  379.     lea    pr_MsgPort(a2),a0
  380.     jsr    _LVOGetMsg(a6)
  381.     move.l    d0,wb_msg(a5)
  382.     beq.s    .C
  383.     move.l    d0,a0
  384.     clr.l    sm_Segment(a0)        Clear Seg-Descriptor
  385. .C    move.l    pr_StackSize(a2),stacksize(a5)
  386.     move.l    pr_SegList(a2),d0
  387.     beq.s    .B
  388.     lsl.l    #2,d0
  389.     move.l    d0,a0
  390.     clr.l    12(a0)            Clear SegPointer
  391.     bra.s    .B
  392. .A    lsl.l    #2,d0            CLI-Start
  393.     move.l    d0,a2
  394.     move.l    cli_DefaultStack(a2),d0
  395.     lsl.l    #2,d0
  396.     move.l    d0,stacksize(a5)    save stacksize
  397.     clr.l    cli_Module(a2)        do not free seglist
  398.     cmp.b    #"r",1(a3)
  399.     bne.s    .B
  400.     addq.b    #1,noresi_flag(a5)
  401. .B    move.l    dosbase(a5),a6        A6=DOSBASE
  402.     tst.b    noresi_flag(a5)
  403.     bne.s    crerror
  404. lookres    lea    ZShellName(pc),a4
  405.     bsr    search_res2
  406.     lea    start-4(pc),a1
  407.     tst.l    d0
  408.     beq.s    cresi
  409.     lsl.l    #2,d0
  410.     move.l    d0,a2
  411.     nop
  412.     nop
  413. VCheck    cmp.w    #VERSION,VCheck-start+6(a2)
  414.     bne.w    crerror
  415.     addq.l    #1,resi_usecount(a0)
  416.     cmp.l    a1,d0
  417.     beq.s    crerror        running as resident
  418.     jmp    JumpIn-start+4(a2) Jump to JumpIn, but in the resident Code
  419. JumpIn;*move.l    a1,d1    here it arrives
  420. ;    lsr.l    #2,d1
  421. ;    jsr    _LVOUnLoadSeg(a6)    free old mem
  422. ;    bra.s    doIT
  423. cresi    lea    ZShellCom(pc),a0
  424.     move.l    a0,d1
  425.     jsr    _LVOLoadSeg(a6)
  426.     lea    ZShellName(pc),a4
  427.     move.l    d0,d3
  428.     beq.s    crerror
  429.     bsr    create_resi    make zshell resident
  430.     bne.s    crerror
  431.     bra.s    lookres
  432.  
  433. crerror    lea    console(pc),a0    output a message
  434.     move.l    a0,d1
  435.     move.l    #1005,d2
  436.     jsr    _LVOOpen(a6)    on a simple CON: window
  437.     move.l    d0,d4
  438.     beq.s    crfail
  439.     move.l    d0,d1
  440.     lea    errtx(pc),a0
  441.     move.l    a0,d2
  442.     move.l    #errtxend-errtx,d3
  443.     jsr    _LVOWrite(a6)
  444.     moveq    #120,d1
  445.     jsr    _LVODelay(a6)    wait a bit
  446.     move.l    d4,d1
  447.     jsr    _LVOClose(a6)
  448. crfail    move.l    dosbase(a5),a1    bad error occured
  449.     move.l    4.w,a6
  450.     jsr    _LVOCloseLibrary(a6)
  451. dosfail    move.l    intuibase(a5),a1
  452.     jsr    _LVOCloseLibrary(a6)
  453. intfail    move.l    wb_msg(a5),d2
  454.     move.l    a5,a1
  455.     move.l    #sizeofblk,d0
  456.     jsr    _LVOFreeMem(a6)
  457.     tst.l    d2
  458.     beq.s    .A
  459.     jsr    _LVOForbid(a6)    (what for ?)
  460.     move.l    d2,a1        WB-Message
  461.     jmp    _LVOReplyMsg(a6)    never returns !
  462. .A    moveq    #0,d0
  463.     rts
  464. blkfail    moveq    #RETURN_ERROR,d0
  465.     rts
  466.     
  467.  
  468. search_res2
  469.     bsr    resi_hand
  470.     beq.s    .D
  471.     move.l    a0,d2
  472. .A    lsl.l    #2,d0
  473.     move.l    a4,a1            string
  474.     move.l    d0,a2
  475.     lea    resi_name(a2),a0    BSTR
  476.     moveq    #0,d3
  477.     move.b    (a0)+,d3
  478.     subq.w    #1,d3
  479. .B    move.b    (a0)+,d0
  480.     move.b    (a1)+,d1
  481.     bsr    compD1D0nocase
  482.     dbne    d3,.B
  483.     bne.s    .E    not equal
  484.     tst.b    (a1)
  485.     beq.s    .C    the (null-)END
  486. .E    move.l    a2,d2
  487.     move.l    resi_link(a2),d0    get link
  488.     bne.s    .A
  489. .D    moveq    #0,d0
  490.     rts
  491. .C    move.l    resi_seglist(a2),d0    get seglist
  492.     move.l    a2,a0
  493.     rts
  494.  
  495. resi_hand    move.l    dl_Root(a6),a0
  496.     move.l    rn_Info(a0),a0
  497.     add.l    a0,a0
  498.     add.l    a0,a0
  499.     lea    di_NetHand(a0),a0    NetHand in A0
  500.     move.l    (a0),d0        Start of Resi-List in D0
  501.     rts
  502.  
  503. compD1D0nocase
  504.     cmp.b    #'a',d1
  505.     blo.s    D1_OK
  506.     cmp.b    #'z',d1
  507.     bhi.s    D1_OK
  508.     sub.b    #$20,d1
  509. D1_OK    cmp.b    #'a',d0
  510.     blo.s    D0_OK
  511.     cmp.b    #'z',d0
  512.     bhi.s    D0_OK
  513.     sub.b    #$20,d0
  514. D0_OK    cmp.b    d1,d0
  515.     rts
  516.  
  517. create_resi        ;D3:SegList, A4:Name
  518.     moveq    #resi_length,d0
  519.     move.l    a4,a0
  520. .A    addq.l    #1,d0    one more for lenght-byte
  521.     tst.b    (a0)+
  522.     bne.s    .A
  523.     addq.l    #4,d0    4 more for segment-length
  524.     addq.l    #8,d0    (8 more for and'ing needed by UnLoadSeg)
  525.     moveq    #-4,d1
  526.     and.l    d1,d0
  527.     move.l    d0,d2
  528.     moveq    #1,d1
  529.     bsr    iwantmem
  530.     beq.s    resi_no_mem
  531.     addq.l    #4,d0
  532.     move.l    d0,a2        D0=addr of resi_list_node
  533.     move.l    d2,-4(a2)    save segment-length
  534.     bsr    do_forbid
  535.     bsr    resi_hand
  536.     move.l    d0,resi_link(a2)
  537.     move.l    a2,d0
  538.     lsr.l    #2,d0
  539.     move.l    d0,(a0)
  540.     moveq    #1,d0
  541.     move.l    d0,resi_usecount(a2)
  542.     move.l    d3,resi_seglist(a2)
  543.     lea    resi_name(a2),a1
  544.     move.l    a4,a0
  545.     moveq    #-1,d0
  546.     bsr    cpBSTR
  547.     bsr    do_permit
  548.     moveq    #0,d0
  549.     rts
  550. resi_no_mem
  551.     moveq    #-1,d0
  552.     rts
  553.  
  554. ******    Copy String from A0 to BSTR A1
  555. cpBSTR    movem.l    d1-d2/a0-a2,-(sp)    max. Length-2 in D0
  556.     lea    1(a1),a2
  557.     moveq    #0,d2
  558.     bra.s    .B
  559. .A    move.b    d1,(a2)+
  560.     addq.l    #1,d2
  561. .B    move.b    (a0)+,d1
  562.     dbeq    d0,.A
  563.     clr.b    (a2)    ;NULL-end it
  564.     move.b    d2,(a1)
  565.     move.l    a1,d0
  566.     lsr.l    #2,d0
  567.     movem.l    (sp)+,d1-d2/a0-a2    D0 is BPTR to the BSTR
  568.     rts
  569.  
  570. *ALLOCATE MEMORY D0=size D1=type
  571. iwantmem    movem.l d1/a0-a1,-(sp)
  572.     move.l 4.w,a6
  573.     jsr _LVOAllocMem(a6)
  574.     move.l dosbase(a5),a6
  575.     movem.l (sp)+,d1/a0-a1
  576.     tst.l    d0
  577.     rts
  578.  
  579. do_forbid    move.l    4.w,a6
  580.     jsr    _LVOForbid(a6)
  581.     move.l    dosbase(a5),a6
  582.     rts
  583. do_permit    move.l    4.w,a6
  584.     jsr    _LVOPermit(a6)
  585.     move.l    dosbase(a5),a6
  586.     rts
  587.     
  588. ZShellCom    dc.b    'C:'
  589. ZShellName    dc.b    'ZShell',0
  590. console        dc.b    'CON:100/20/450/80/$VER: ZSH 2.2 (02.01.95)',0
  591. errtx        dc.b    'Please copy "ZShell" to C: !'
  592. errtxend
  593. dosname        dc.b    'dos.library',0
  594. intuiname    dc.b    'intuition.library',0
  595.  
  596.     end
  597. ****************************************************************
  598.  
  599.